package com.czk.desensitization;

/**
 * 脱敏策略
 *
 * @Author:ChenZhangKun
 * @Date: 2021/4/18 14:32
 */
public enum  DesensitizationStrategy {
    // 密码脱敏策略
    PASSWORD(s->s="****"),
    // 用户名脱敏策略
    USERNAME(s->s.replaceAll("(\\S)\\S(\\S)","$1*$2"));
    private final Desensitizer desensitizer;
    DesensitizationStrategy(Desensitizer desensitizer) {
        this.desensitizer=desensitizer;
    }

    public Desensitizer getDesensitizer() {
        return desensitizer;
    }
}
